<template>
	<el-drawer title="合同详情" v-model="visible" :size="800" destroy-on-close @closed="$emit('closed')">
		<el-container v-loading="loading">
			<el-main>
				<el-form>
					<el-form-item label="合同标题" prop="title">{{form.title}}</el-form-item>
					<el-row :gutter="24">
						<el-col :lg="12">
							<el-form-item label="合同编号" prop="contractCode">{{form.contractCode}}</el-form-item>
						</el-col>
						<el-col :lg="12">
							<el-form-item label="合同类型" prop="contractType">{{form.contractTypeName}}</el-form-item>
						</el-col>
					</el-row>
					<el-row :gutter="24">
						<el-col :lg="12">
							<el-form-item label="履行期限(起)" prop="startTime">{{form.startTime}}</el-form-item>
						</el-col>
						<el-col :lg="12">
							<el-form-item label="履行期限(止)" prop="endTime">{{form.endTime}}</el-form-item>
						</el-col>
					</el-row>
					<el-row :gutter="24">
						<el-col :lg="12">
							<el-form-item label="结算方式" prop="payType">{{form.payTypeName}}</el-form-item>
						</el-col>
						<el-col :lg="12">
							<el-form-item label="结算币种" prop="cashType">{{form.cashTypeName}}</el-form-item>
						</el-col>
					</el-row>
					<el-row :gutter="24">
						<el-col :lg="12">
							<el-form-item label="合同金额" prop="total">{{form.total}}/元</el-form-item>
						</el-col>
						<el-col :lg="12">
							<el-form-item label="已收金额" prop="realTotal">{{form.realTotal}}/元</el-form-item>
						</el-col>
					</el-row>
					<el-row :gutter="24">
						<el-col :lg="12">
							<el-form-item label="签订时间" prop="signTime">{{form.signTime}}</el-form-item>
						</el-col>
						<el-col :lg="12">
							<el-form-item label="签订地址" prop="signAddress">{{form.signAddress}}</el-form-item>
						</el-col>
					</el-row>
					<el-row :gutter="24">
						<el-col :lg="12">
							<el-form-item label="对方名称" prop="customerName">{{form.customerName}}</el-form-item>
						</el-col>
						<el-col :lg="12">
							<el-form-item label="我方名称" prop="myOrgName">{{form.myOrgName}}</el-form-item>
						</el-col>
					</el-row>
					<el-row :gutter="24">
						<el-col :lg="12">
							<el-form-item label="对方地址" prop="registerAddr">{{form.registerAddr}}</el-form-item>
						</el-col>
						<el-col :lg="12">
							<el-form-item label="我方地址" prop="myOrgAdd">{{form.myOrgAdd}}</el-form-item>
						</el-col>
					</el-row>
					<el-row :gutter="24">
						<el-col :lg="12">
							<el-form-item label="对方法人" prop="legalPerson">{{form.legalPerson}}</el-form-item>
						</el-col>
						<el-col :lg="12">
							<el-form-item label="我方法人" prop="myLegalPerson">{{form.myLegalPerson}}</el-form-item>
						</el-col>
					</el-row>
					<el-row :gutter="24">
						<el-col :lg="12">
							<el-form-item label="对方签订人" prop="customerSignUser">{{form.customerSignUser}}</el-form-item>
						</el-col>
						<el-col :lg="12">
							<el-form-item label="我方签订人" prop="mySignUser">{{form.mySignUser}}</el-form-item>
						</el-col>
					</el-row>
					<el-row :gutter="24">
						<el-col :lg="12">
							<el-form-item label="联系电话" prop="mobile">{{form.mobile}}</el-form-item>
						</el-col>
						<el-col :lg="12">
							<el-form-item label="我方联系电话" prop="mySignMobile">{{form.mySignMobile}}</el-form-item>
						</el-col>
					</el-row>
					<el-row :gutter="24">
						<el-col :lg="12">
							<el-form-item label="对方开户行" prop="bank">{{form.bank}}</el-form-item>
						</el-col>
						<el-col :lg="12">
							<el-form-item label="我方开户行" prop="myBank">{{form.myBank}}</el-form-item>
						</el-col>
					</el-row>
					<el-row :gutter="24">
						<el-col :lg="12">
							<el-form-item label="对方账号" prop="bankAccount">{{form.bankAccount}}</el-form-item>
						</el-col>
						<el-col :lg="12">
							<el-form-item label="我方账号" prop="myBankAccount">{{form.myBankAccount}}</el-form-item>
						</el-col>
					</el-row>
					<el-row :gutter="24">
						<el-col :lg="12">
							<el-form-item label="对方税号" prop="taxNo">{{form.taxNo}}</el-form-item>
						</el-col>
						<el-col :lg="12">
							<el-form-item label="我方税号" prop="myTaxNo">{{form.myTaxNo}}</el-form-item>
						</el-col>
					</el-row>
					<el-form-item label="合同内容">
						<div v-html="form.content"></div>
					</el-form-item>
					<el-form-item label="相关附件" v-if="form.attachId!=''">
						<attach-menu :attachIds="form.attachId" :roleFlag="3" :preview="true"></attach-menu>
					</el-form-item>
				</el-form>
				<el-footer style="text-align: center;">
					<el-button @click="visible=false">关闭</el-button>
				</el-footer>
			</el-main>
		</el-container>
	</el-drawer>
</template>

<script>
import AttachMenu from '@/views/module/attachMenu'
export default {
	emits: ['success', 'closed'],
	components: {
		AttachMenu,
	},
	data() {
		return {
			loading: false,
			form: {
				contractId:'',
				sortId:'',
				title: '',
				contractCode: '',
				contractTypeName: '',
				startTime: '',
				endTime: '',
				payTypeName: '',
				cashTypeName: '',
				total: 0,
				realTotal: 0,
				signTime: '',
				signAddress: '',
				customerName: '',
				myOrgName: '',
				registerAddr: '',
				myOrgAdd: '',
				legalPerson: '',
				myLegalPerson: '',
				customerSignUser: '',
				mySignUser: '',
				mobile: '',
				mySignMobile: '',
				bank: '',
				myBank: '',
				bankAccount: '',
				myBankAccount: '',
				taxNo: '',
				myTaxNo: '',
				content: '',
				accountId: ''
			},
			visible: false,
			isSaveing: false,
		}
	},
	mounted() {

	},
	methods: {
		//显示
		open(model){
			this.model=model;
			this.visible = true;
			return this;
		},
		//表单注入数据
		setData(data){
			this.form.contractId = data.contractId
			this.form.assetsId = data.assetsId
			this.form.sortId = data.sortId
			this.form.title = data.title
			this.form.contractCode = data.contractCode
			this.form.contractTypeName = data.contractTypeName
			this.form.startTime = data.startTime
			this.form.endTime = data.endTime
			this.form.payTypeName = data.payTypeName
			this.form.cashTypeName = data.cashTypeName
			this.form.total = data.total
			this.form.realTotal = data.realTotal
			this.form.signTime = data.signTime
			this.form.signAddress = data.signAddress
			this.form.customerName = data.customerName
			this.form.myOrgName = data.myOrgName
			this.form.registerAddr = data.registerAddr
			this.form.myOrgAdd = data.myOrgAdd
			this.form.legalPerson = data.legalPerson
			this.form.myLegalPerson = data.myLegalPerson
			this.form.customerSignUser = data.customerSignUser
			this.form.mySignUser = data.mySignUser
			this.form.mobile = data.mobile
			this.form.mySignMobile = data.mySignMobile
			this.form.bank = data.bank
			this.form.myBank = data.myBank
			this.form.bankAccount = data.bankAccount
			this.form.myBankAccount = data.myBankAccount
			this.form.taxNo = data.taxNo
			this.form.myTaxNo = data.myTaxNo
			this.form.content = data.content
			this.form.accountId = data.accountId
		},
		async showDetail(data){
			let res = await this.$API.finance.contract.getContractById.get({contractId:data});
			{
				if(res.code==200)
				{
					this.form =res.data
				}else
				{
					this.$alert(res.message, "提示", {type: 'error'})
				}
			}
		}



	}
}
</script>

<style>
</style>
